﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="MyEnergy.Resources">

    <!-- Window Close Button -->
    <Style x:Key="CloseButton" TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="ButtonBorder" BorderBrush="#4B4B4B" BorderThickness="1,0,1,1" CornerRadius="0,0,4,4" Width="35">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#E1E1E1" Offset="0.5"/>
                                    <GradientStop Color="#C3C3C3" Offset="1"/>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Path x:Name="CloseButtonPath" Stroke="DarkRed" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" StrokeThickness="2" SnapsToDevicePixels="True" Margin="12,4,12,4">
                            <Path.Data>
                                <GeometryGroup>
                                    <LineGeometry StartPoint="0,0" EndPoint="5,5"/>
                                    <LineGeometry StartPoint="5,0" EndPoint="0,5"/>
                                </GeometryGroup>
                            </Path.Data>
                        </Path>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.Setters>
                                <Setter TargetName="ButtonBorder" Property="Background">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <LinearGradientBrush.GradientStops>
                                                <GradientStop Color="#F07171" Offset="0.4"/>
                                                <GradientStop Color="#C93333" Offset="0.90"/>
                                                <GradientStop Color="#DB7D2F" Offset="0.95"/>
                                                <GradientStop Color="#F3CC7B" Offset="1"/>
                                            </LinearGradientBrush.GradientStops>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="CloseButtonPath" Property="Stroke" Value="White"/>
                            </Trigger.Setters>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>

    <!-- App Background -->
    <LinearGradientBrush x:Key="AppBackground" StartPoint="0,0" EndPoint="0,1" >
        <GradientStop Color="#C3C3C3" Offset="0.20"/>
        <GradientStop Color="#A3A3A3" Offset="0.60"/>
        <GradientStop Color="#9D9D9D" Offset="1"/>
    </LinearGradientBrush>

    <!-- Window Style -->
    <Style TargetType="{x:Type Window}" x:Key="WindowStyle" >
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Window">
                    <Grid>

                        <Grid.RowDefinitions>
                            <RowDefinition Name="WindowTitleRow" Height="26"/>
                            <RowDefinition Name="WindowContentRow" Height ="*"/>
                        </Grid.RowDefinitions>

                        <Border x:Name="WindowTitleBorder" BorderBrush="Gray" CornerRadius="10,10,0,0" Grid.Row="0" BorderThickness="1,1,1,0" Background="#C3C3C3" MouseLeftButtonDown="WindowTitleBorder_MouseLeftButtonDown">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <!--<Image Source="{TemplateBinding Window.Icon}" Width="20" Height="20" Margin="3" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
                                <Label Grid.Column="0" FontWeight="Bold" Margin="5,0,0,0">
                                    <TextBlock x:Name="WindowCaptionTextColor" Text="{TemplateBinding Window.Title}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                </Label>
                                <Button Grid.Column="1" Style="{StaticResource CloseButton}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,0,8,5" Click="closeBtn_Click"/>
                            </Grid>
                        </Border>

                        <Border x:Name="WindowContentBorder" BorderBrush="Gray" CornerRadius="0,0,10,10" Grid.Row="1" BorderThickness="1,0,1,1" Background="{StaticResource AppBackground}">
                            <ContentPresenter />
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>